package service;

import dao.BookDao;
import dao.BookDaoImpl;
import entry.Books;
import util.PageHelper;

import java.util.ArrayList;

public class BookServiceImpl implements BookService {
    BookDao bookDao = new BookDaoImpl();
    @Override
    public boolean addBook(Books book) {
        return bookDao.insertBook(book) != 0 ? true : false;
    }

    @Override
    public boolean delete(int bookid) {
        return bookDao.delete(bookid);
    }

    @Override
    public Books selectById(int bookid) {
        return bookDao.selectById(bookid);
    }

    @Override
    public boolean updateBook(Books book) {
        System.out.println("金静远改了这里");
        return bookDao.updateBook(book);
    }



    @Override
    public ArrayList<Books> selectMatch(Books book, PageHelper pageHelper) {
        System.out.println("进service层了");
        System.out.println(pageHelper);
        System.out.println(book);
        ArrayList<Books> books = bookDao.selectMatch(book, pageHelper);
        System.out.println(books);
        return books;
    }

    @Override
    public int selectBookSize(Books book) {
        return bookDao.selectBookSize(book);
    }
}
